/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * frmSinhvien.java
 *
 * Created on Feb 23, 2013, 10:53:16 PM
 */
package design;
// tao ra chi de goi vao phan cua to cho khong con loi thoi chua lam gi

import Dao.DangkiHP;

/**
 *
 * @author Thuyngaytho
 */
public class frmSinhvien extends javax.swing.JFrame {
 String maSV;
    /** Creates new form frmSinhvien */
    public frmSinhvien() {
        initComponents();
    }

     public frmSinhvien(String MaSV,String Hoten,String LopSH,String NienKhoa) throws Exception {
        initComponents();
       
        DangkiHP dangkiHP = new DangkiHP();
        lbMa.setText(MaSV);
        lbTen.setText(Hoten);
        lbTenLop.setText(LopSH);
        lbNienkhoa.setText(NienKhoa);
        lbKhoa.setText(dangkiHP.layTenkhoaByMaSV(MaSV));
        //
        this.maSV = MaSV;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnThongTinSV = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        lbMa = new javax.swing.JLabel();
        lbTen = new javax.swing.JLabel();
        lbTenLop = new javax.swing.JLabel();
        lbNienkhoa = new javax.swing.JLabel();
        lbKhoa = new javax.swing.JLabel();
        pnChucNang = new javax.swing.JPanel();
        btnDangKyHocpHan = new javax.swing.JButton();
        btnXemTKB = new javax.swing.JButton();
        btnXemTB = new javax.swing.JButton();
        btnDoiMK = new javax.swing.JButton();
        btnThoat = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        pnThongTinSV.setBackground(new java.awt.Color(255, 255, 255));
        pnThongTinSV.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Thông tin sinh viên", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 0, 18))); // NOI18N

        jLabel1.setText("Mã sinh viên :");

        jLabel2.setText("Họ tên :");

        jLabel3.setText("Tên lớp :");

        jLabel4.setText("Niên khóa :");

        jLabel5.setText("Khoa :");

        lbMa.setText("Mã");

        lbTen.setText("Tên");

        lbTenLop.setText("Tên lớp");

        lbNienkhoa.setText("Niên khóa");

        lbKhoa.setText("Khoa");

        javax.swing.GroupLayout pnThongTinSVLayout = new javax.swing.GroupLayout(pnThongTinSV);
        pnThongTinSV.setLayout(pnThongTinSVLayout);
        pnThongTinSVLayout.setHorizontalGroup(
            pnThongTinSVLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnThongTinSVLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnThongTinSVLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel2)
                    .addGroup(pnThongTinSVLayout.createSequentialGroup()
                        .addGroup(pnThongTinSVLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5))
                        .addGap(28, 28, 28)
                        .addGroup(pnThongTinSVLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lbKhoa, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lbNienkhoa, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lbTenLop, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lbTen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lbMa, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE))))
                .addContainerGap(77, Short.MAX_VALUE))
        );
        pnThongTinSVLayout.setVerticalGroup(
            pnThongTinSVLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnThongTinSVLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnThongTinSVLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(lbMa))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnThongTinSVLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(lbTen))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnThongTinSVLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(lbTenLop))
                .addGap(18, 18, 18)
                .addGroup(pnThongTinSVLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnThongTinSVLayout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel5))
                    .addGroup(pnThongTinSVLayout.createSequentialGroup()
                        .addComponent(lbNienkhoa)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lbKhoa)))
                .addGap(7, 7, 7))
        );

        pnChucNang.setBackground(new java.awt.Color(255, 255, 255));

        btnDangKyHocpHan.setText("Đăng ký học phần");
        btnDangKyHocpHan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDangKyHocpHanActionPerformed(evt);
            }
        });

        btnXemTKB.setText("Xem thời khóa biểu");
        btnXemTKB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnXemTKBActionPerformed(evt);
            }
        });

        btnXemTB.setText("Xem thông báo");
        btnXemTB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnXemTBActionPerformed(evt);
            }
        });

        btnDoiMK.setText("Đổi mật khẩu");
        btnDoiMK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDoiMKActionPerformed(evt);
            }
        });

        btnThoat.setText("Thoát");
        btnThoat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnThoatActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnChucNangLayout = new javax.swing.GroupLayout(pnChucNang);
        pnChucNang.setLayout(pnChucNangLayout);
        pnChucNangLayout.setHorizontalGroup(
            pnChucNangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnChucNangLayout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addGroup(pnChucNangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btnThoat, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnDoiMK, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnXemTKB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnDangKyHocpHan)
                    .addComponent(btnXemTB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(42, Short.MAX_VALUE))
        );
        pnChucNangLayout.setVerticalGroup(
            pnChucNangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnChucNangLayout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(btnDangKyHocpHan)
                .addGap(32, 32, 32)
                .addComponent(btnXemTKB)
                .addGap(28, 28, 28)
                .addComponent(btnXemTB)
                .addGap(29, 29, 29)
                .addComponent(btnDoiMK)
                .addGap(27, 27, 27)
                .addComponent(btnThoat)
                .addContainerGap(25, Short.MAX_VALUE))
        );

        jPanel3.setBackground(new java.awt.Color(255, 255, 255));

        jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/StudentSuccess.jpg"))); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnThongTinSV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(pnChucNang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnThongTinSV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnChucNang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void btnDangKyHocpHanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDangKyHocpHanActionPerformed
// TODO add your handling code here:
    try {
            new frmDangKyHocPhan(lbMa.getText(), lbTen.getText(), lbTenLop.getText(), lbNienkhoa.getText()).setVisible(true);
            this.setVisible(false);
        } catch (Exception e) {
            e.printStackTrace();
        }
}//GEN-LAST:event_btnDangKyHocpHanActionPerformed

private void btnXemTKBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnXemTKBActionPerformed
// TODO add your handling code here:
     try {
            new frmThoiKhoaBieu(lbMa.getText(), lbTen.getText(), lbTenLop.getText(), lbNienkhoa.getText(), false, 0).setVisible(true);
            this.setVisible(false);
        } catch (Exception e) {
            e.printStackTrace();
        }
}//GEN-LAST:event_btnXemTKBActionPerformed

private void btnXemTBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnXemTBActionPerformed
// TODO add your handling code here:
    try{
            new DialogXemThongBao(this, true, maSV, 0).setVisible(true);
        }
        catch(Exception e){
            e.printStackTrace();
        }
}//GEN-LAST:event_btnXemTBActionPerformed

private void btnDoiMKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDoiMKActionPerformed
// TODO add your handling code here:
    // new DialogDoiMatKhau(this, true, lbMa.getText()).setVisible(true);
     new DialogDoiMatkhau(this, true, lbMa.getText()).setVisible(true);
}//GEN-LAST:event_btnDoiMKActionPerformed

private void btnThoatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnThoatActionPerformed
// TODO add your handling code here:
    this.setVisible(false);
        new FormLogin(this, rootPaneCheckingEnabled).setVisible(true);
}//GEN-LAST:event_btnThoatActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frmSinhvien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frmSinhvien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frmSinhvien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frmSinhvien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new frmSinhvien().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnDangKyHocpHan;
    private javax.swing.JButton btnDoiMK;
    private javax.swing.JButton btnThoat;
    private javax.swing.JButton btnXemTB;
    private javax.swing.JButton btnXemTKB;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JLabel lbKhoa;
    private javax.swing.JLabel lbMa;
    private javax.swing.JLabel lbNienkhoa;
    private javax.swing.JLabel lbTen;
    private javax.swing.JLabel lbTenLop;
    private javax.swing.JPanel pnChucNang;
    private javax.swing.JPanel pnThongTinSV;
    // End of variables declaration//GEN-END:variables
}
